import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
 
  {
    path:'/',
    name:'regist',
    component:()=>import('../views/regist')
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('../views/login')
  },
  {
    path:'/personCener',
    name:'personCener',
    component:()=>import('../views/default/personCener'),
    redirect: {name:'center'},
    children:[
      {
        path:'shopping',
        name:'shopping',
        component:()=>import('../views/default/shopping')
      },
      {
        path:'center',
        name:'center',
        component:()=>import('../views/default/center'),
        redirect:{name:'pcbottom'},
        children:[
          {
            path:'pcbottom',
            name:'pcbottom',
            component:()=>import('../views/center/pcbottom')
          },
          {
            path:'exchange',
            name:'exchange',
            component:()=>import('../views/center/exchange')
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

router.beforeEach((to, from, next)=> {
  console.log('to', to);
  console.log('from', from);
  next();
})

export default router
